const compose = require('koa-compose')
const fs = require('fs');
registerRouter = () => {
    let routers = [];
    fs.readdirSync('./routers').filter(value => (value.indexOf('index.js') === -1))
        .map(router => {
            router = './' + router;
            console.log(router);
            routers.push(require(router).routes())
            routers.push(require(router).allowedMethods())
        })
    return compose(routers)
}

module.exports = registerRouter